import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
  {
    path: '/Login',
    name: 'login',
    component: () => import('../components/Login.vue')
  },
  {
    path: '/',
    name: 'home',
    component: HomeView,
    // redirect: '/about',//页面默认加载的路由
    meta: {
      title: '首页',
      path: "/"
    },
    children: [
      {
        path: '/about',
        component: () => import('../views/AboutView.vue'),
        meta: {
          title: 'about',
          path: "/about"
        }
      },
      {
        path: '/son1', component: () => import('../components/son1.vue'),
        meta: {
          title: 'son1',
          path: "/son1"
        }
      },
      {
        path: '/son2', component: () => import('../components/son2.vue'),
        meta: {
          title: 'son2',
          path: "/son2"
        }
      }
    ]
  },
  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  // }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
